package com.ubao.base;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

import com.mobclick.android.MobclickAgent;
import com.ubao.activity.MyApp;

/**
 * Activity基类
 * 
 */
public abstract class BaseActivity extends Activity {

	/** 到时候提供一个统一返回当前项目的方法 */
//	private FeedBackManager mFeedBackManager = new FeedBackManager();

	protected Intent mIntent;

	protected Bundle mBundle;

	/** 用作初始化View，findViewById */
	protected abstract void initView();

	/** 获取界面传值的数据值 */
	protected abstract void getIntentData();

	/** 设置界面传值的数据值 */
	protected abstract void setIntentData();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		MyApp.activityList.add(this);
	//  MobclickAgent.onError(this);
		
		getIntentData();
		initView();
		
	}

	@Override
	protected void onPause() {
		super.onPause();
		stopLocate();
		//MobclickAgent.onPause(this);
//		mFeedBackManager.onPause(this);
	}
	
	protected void startLocate(){
		MyApp.locationManager.locate();
	}
	
	protected void stopLocate(){
		MyApp.locationManager.exit();
	}

	@Override
	protected void onStop() {
		super.onStop();
	}

	@Override
	protected void onResume() {
		super.onResume();
		startLocate();
		//MobclickAgent.onResume(this);
//		mFeedBackManager.onResume(this);
	}

	@Override
	protected void onStart() {
		super.onStart();
	}

	@Override
	protected void onDestroy() {
		MyApp.activityList.remove(this);
		System.gc();

		super.onDestroy();
	}
	
	protected void showToast(String content){
		Toast.makeText(this, content, Toast.LENGTH_SHORT).show();
	}
}
